<template>
  <view class="page">
    <view v-if="list.length == 0" class="noneData"></view>
    <goodRow :list="list">
      <template #btns="{ item }">
        <view class="delBtn" @click="shanchu(item.article_id)"> 删除 </view>
      </template>
    </goodRow>
  </view>
</template>
<script>
import goodRow from '../../components/goodRow.vue'
export default {
  components: { goodRow },
  data() {
    return {
      list: []
    }
  },
  onLoad(option) {
    this.getData()
  },
  methods: {
    shanchu(id) {
      var that = this
      uni.showModal({
        content: '确认删除吗',
        success: res => {
          if (res.confirm) {
            this.$http({
              url: 'collect',
              data: {
                id: id,
                type: 2
              }
            }).then(res => {
              this.getData()
              uni.showToast({
                title: '操作成功',
                icon: 'none' //
              })
              that.getData()
            })
          }
        }
      })
    },
    getData() {
      var that = this
      this.$http({ url: 'getCollectList' }).then(res => {
        that.list = res.data.data
        // .map(el => {
        //   let arr = el.url.split(',')
        //   arr.some(item => {
        //     if (!item.endsWith('.mp4')) {
        //       el.thumb_image = item
        //       return true
        //     } else {
        //       el.video = item
        //     }
        //   })
        //   return el
        // })
      })
    }
  }
}
</script>
<style lang="scss" scoped>
@import '../common/common.css';
.page {
  background-color: rgba(248, 248, 248, 1);
  position: relative;
  width: 100%;
  min-height: 100vh;
  padding: 0 2.5%;
  overflow: hidden;
  overflow-y: scoll;
  padding-bottom: 50px;
}

.delBtn {
  font-size: 15px;
  border-radius: 12px;
  border: 1px solid rgba(241, 241, 241, 1);
  text-align: center;
  margin-top: 10px;
  width: 120rpx;
  height: 60rpx;
  line-height: 55rpx;
  border-radius: 20px;
  margin-left: 150px;
}
</style>
